package reflect;

import reflect.annotations.AutoRunMethod;

import java.lang.reflect.Method;

/*
访问方法上的注解
 */
public class ReflectDemo10 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException {
        Class c=Class.forName("reflect.Person");
        Method method = c.getMethod("playGame");

        boolean mark=method.isAnnotationPresent(AutoRunMethod.class);
        System.out.println(mark?"有": "没有");
    }
}
